package com.sjz.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sjz.utils.StreamTool;

/**
 *  接收安卓端发送过来的xml内容
 */
public class XmlServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			//得到传过来的值  以流的方式得到
			byte[] data = StreamTool.read(request.getInputStream());
			String xml = new String(data, "UTF-8");
			//把内容输出到控制台
			System.out.println(xml);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
